﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>网站基本设置 - 添加友情链接</title>
<script src="/js/jquery.js" type="text/javascript"></script>
<script src="/js/jspublic.js" type="text/javascript"></script>
<script src="js/easyui/jquery.easyui.js" type="text/javascript"></script>
<script src="js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<link href="style/right.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	
	$(function(){

		if (window.frameElement == null) self.location = '/manage';
		
		checktype();
		
		$("#form1 input[id^=l_]").validatebox({ required:true });
		
		$.extend($.fn.validatebox.defaults.rules, {
			num: {
				validator: function (value) {
					return /^(0|99|[1-9]\d?)$/.test(value);
				},
				message: '只能输入小于100的数字'
			}			
		});
				
		$('#l_type').change(function(){
			checktype();
        });
		
		$('#form1').submit(function(){
			if($("#l_name").validatebox('isValid') == false){return $("#l_name").validatebox('isValid');}
			if($("#l_url").validatebox('isValid') == false){return $("#l_url").validatebox('isValid');}
			if($("#l_order").validatebox('isValid') == false){return $("#l_order").validatebox('isValid');}
			if($('#l_type').val() == '0'){
				return true;
			}
			else {
				return $("#l_img").validatebox('isValid');
			}
			return true;			
		});
		
		function checktype(){		
			if($('#l_type').val() == '0') $('#l_img_up').hide();
			if($('#l_type').val() == '1') $('#l_img_up').show();
		}
    });
	
</script>
</head>

<body>
<div class="zs_content">

	<div class="zs_quota">
		<h4>网站基本设置 - 添加友情链接</h4>
	</div>
	
	<div class="zs_sys">
		<form action="admin_add.aspx?T=b_links&id=[id]" method="post" name="form1" id="form1" onsubmit="return checkForm();" enctype="multipart/form-data">
		<ul>
			<li>
				<label>名称：</label>
				<div class="controls">
					<input type="text" id="l_name" name="l_name" type="text" missingMessage="不能为空" maxlength="50" />
				</div>
			</li>
			<li>
				<label>地址：</label>
				<div class="controls">
					<input type="text" id="l_url" name="l_url" type="text" validType="url" missingMessage="不能为空" invalidMessage="非法的URL地址" />
				</div>
			</li>
			<li>
				<label>类型：</label>
				<div class="controls">
					<select id="l_type" name="l_type">
						<option value="0" selected>文本</option>
						<option value="1">图片</option>
					</select>
				</div>
			</li>
			<li id="l_img_up">
				<label>图片：</label>
				<div class="controls">
					<input type="text" id="l_img" name="l_img" type="file" missingMessage="不能为空" />
				</div>
			</li>
			<li>
				<label>排序：</label>		
				<div class="controls">
					<input type="text" id="l_order" name="l_order" type="text" validType="num" missingMessage="不能为空" maxlength="50" />
				</div>
			</li>
			<li class="act">
				<label></label>
				<div class="controls">
					<input type="submit" id="Submit" name="Submit" value="添加" class="btn btn-primary" />
					<input type="button" name="back" value="返回" class="btn btn-primary" onclick="javascript:window.history.go(-1);" />
				</div>
			</li>
		</ul>
		</form>
	</div>
	
</div>
	
</body>
</html>